/*
 * 获取当天的日期和星期
 * 返回值：年-月-日-星期，举例2017-12-6
 */
function initDays() {
	var currentDate = new Date();
	var cyear = currentDate.getFullYear();
	var cmonth = currentDate.getMonth() + 1;
	var cday = currentDate.getDate();
	if(cmonth < 10) {
		cmonth = "0" + cmonth;
	}
	var thisDay = cyear + "-" + cmonth + "-" + cday;
	return thisDay;
}

/*
 *获取本周的开始时间和结束时间
 * 入参:paramsDay:2017-12-06,即当前日期是2017年12月6日星期三
 * 出参:[本周开始时间,本周结束时间]，举例：[2017-12-04,2017-12-10]
 * */
function thisWeek(paramsDay) {
	var currentDate = paramsDay.split("-");
	var cyear = parseInt(currentDate[0]);
	var cmonthStr = currentDate[1];
	if(cmonthStr.indexOf('0') == 0) {
		cmonthStr = cmonthStr.substring(1, cmonthStr.length);
	}
	var cmonth = parseInt(cmonthStr);
	var cdayStr = currentDate[2];
	if(cdayStr.indexOf('0') == 0) {
		cdayStr = cdayStr.substring(1, cdayStr.length);
	}
	var cday = parseInt(cdayStr);
	var weekDay = getWeekDayNum(cyear, cmonth - 1, cday);
	var syear = cyear;
	var smonth = cmonth;
	var eyear = cyear;
	var emonth = cmonth;
	var sday = cday - weekDay + 1;
	var eday = cday + 7 - weekDay;
	var maxDay = getMonthMaxDay(cyear % 100 + '-' + currentDate[1]);
	if(eday > maxDay) {
		emonth += 1;
		eday = eday - maxDay;
		if(emonth == 13) {
			eyear += 1;
			emonth = 1;
		}
	}
	if(sday < 1) {
		smonth -= 1;
		if(smonth < 1) {
			syear -= 1;
			smonth = 12;
		}
		var sMaxDay = 0;
		if(smonth > 9) {
			sMaxDay = getMonthMaxDay(syear % 100 + '-' + smonth);
		} else {
			sMaxDay = getMonthMaxDay(syear % 100 + '-0' + smonth);
		}

		sday = sMaxDay + sday;
	}
	var endStr = outDays(eyear, emonth, eday);
	var startStr = outDays(syear, smonth, sday);
	return [startStr, endStr];
}

/*
 *获取上周的开始时间和结束时间
 * 入参:paramsDay:2017-12-06,即当前日期是2017年12月6日星期三
 * 出参:[上周开始时间,上周结束时间],举例[2017-11-28,2017-12-03]
 * */
function lastWeek(paramsDay) {
	var currentDate = paramsDay.split("-");
	var cyear = parseInt(currentDate[0]);
	var cmonthStr = currentDate[1];
	if(cmonthStr.indexOf('0') == 0) {
		cmonthStr = cmonthStr.substring(1, cmonthStr.length);
	}
	var cmonth = parseInt(cmonthStr);
	var cdayStr = currentDate[2];
	if(cdayStr.indexOf('0') == 0) {
		cdayStr = cdayStr.substring(1, cdayStr.length);
	}
	var cday = parseInt(cdayStr);
	cday -= 7;
	if(cday < 1) {
		cmonth = cmonth - 1;
		if(cmonth == 0) {
			cyear -= 1;
			cmonth = 12;
		}
		var maxDay = 0;
		if(cmonth > 9) {
			maxDay = getMonthMaxDay(cyear % 100 + '-' + cmonth);
		} else {
			maxDay = getMonthMaxDay(cyear % 100 + '-0' + cmonth);
		}
		cday = maxDay + cday;
	}
	var descStr = cyear + "-" + cmonth + "-" + cday;
	var descArr = thisWeek(descStr);
	return descArr;
}

/*
 *获取下周的开始时间和结束时间
 * 入参:paramsDay:2017-12-6-3,即当前日期是2017年12月6日星期三
 * 出参:[下周开始时间,下周结束时间]，举例[2017-12-11,2017-12-17]
 * */
function nextWeek(paramsDay) {
	var currentDate = paramsDay.split("-");
	var cyear = parseInt(currentDate[0]);
	var cmonthStr = currentDate[1];
	if(cmonthStr.indexOf('0') == 0) {
		cmonthStr = cmonthStr.substring(1, cmonthStr.length);
	}
	var cmonth = parseInt(cmonthStr);
	var cdayStr = currentDate[2];
	if(cdayStr.indexOf('0') == 0) {
		cdayStr = cdayStr.substring(1, cdayStr.length);
	}
	var cday = parseInt(cdayStr);
	cday += 7;
	var maxDay = getMonthMaxDay(cyear % 100 + '-' + currentDate[1]);
	if(cday > maxDay) {
		cmonth += 1;
		cday = cday - maxDay;
		if(cmonth == 13) {
			cyear += 1;
			cmonth = 1;
		}
	}
	var descStr = cyear + "-" + cmonth + "-" + cday;
	var descArr = thisWeek(descStr);
	return descArr;
}

/*
 * 用年，月，日，转换为字符串
 * oyear：年
 * omonth：月
 * oday：日
 * 返回值：年-月-日，举例 2017-01-01
 */
function outDays(oyear, omonth, oday) {
	var descStr;
	if(omonth < 10) {
		descStr = oyear + "-0" + omonth;
	} else {
		descStr = oyear + "-" + omonth;
	}
	if(oday < 10) {
		descStr = descStr + "-0" + oday;
	} else {
		descStr = descStr + "-" + oday;
	}
	return descStr;
}

/*
 * 获取当前年月
 * 出参19-02
 */
function getYearMonthStr() {
	var currentDate = new Date();
	var cyear = currentDate.getFullYear();
	var cmonth = currentDate.getMonth() + 1;
	var descStr = '';
	if(cmonth < 10) {
		descStr = cyear + "-0" + cmonth;
	} else {
		descStr = cyear + "-" + cmonth;
	}
	return descStr.substring(2, descStr.length);
}
/*
 * 获取某月的上一月
 * 入参 19-02
 */
function getLastYearMonthStr(yearMonth) {
	var dateArr = yearMonth.split('-')
	var cyear = dateArr[0];
	var cmonth = dateArr[1];
	if(cyear.indexOf('0') == 0) {
		cyear = cyear.substring(1, cyear.length);
	}
	var cyearInt = parseInt(cyear);
	if(cmonth.indexOf('0') == 0) {
		cmonth = cmonth.substring(1, cmonth.length);
	}
	var cmonthInt = parseInt(cmonth);
	cmonthInt -= 1;
	if(cmonthInt < 1) {
		cmonthInt = 12;
		cyearInt -= 1;
		if(cyearInt < 0) {
			cyearInt = 99;
		}
	}
	if(cmonthInt < 10) {
		cmonth = "0" + cmonthInt;
	} else {
		cmonth = cmonthInt;
	}
	if(cyearInt < 10) {
		cyear = "0" + cyearInt;
	} else {
		cyear = cyearInt;
	}
	return cyear + '-' + cmonth;
}

/*
 * 获取某月的下一月
 * 入参 19-02
 */
function getNextYearMonthStr(yearMonth) {
	var dateArr = yearMonth.split('-')
	var cyear = dateArr[0];
	var cmonth = dateArr[1];
	if(cyear.indexOf('0') == 0) {
		cyear = cyear.substring(1, cyear.length);
	}
	var cyearInt = parseInt(cyear);
	if(cmonth.indexOf('0') == 0) {
		cmonth = cmonth.substring(1, cmonth.length);
	}
	var cmonthInt = parseInt(cmonth);
	cmonthInt += 1;
	if(cmonthInt > 12) {
		cmonthInt = 1;
		cyearInt += 1;
		if(cyearInt > 99) {
			cyearInt = 0;
		}
	}
	if(cmonthInt < 10) {
		cmonth = "0" + cmonthInt;
	} else {
		cmonth = cmonthInt;
	}
	if(cyearInt < 10) {
		cyear = "0" + cyearInt;
	} else {
		cyear = cyearInt;
	}
	return cyear + '-' + cmonth;
}

/*
 * 获取今天日期
 * 出参 2019-02-14
 */
function getTodayStr() {
	var currentDate = new Date();
	var cyear = currentDate.getFullYear();
	var cmonth = currentDate.getMonth() + 1;
	var cday = currentDate.getDate();
	var monthStr = cmonth;
	var dayStr = cday;
	if(cmonth < 10) {
		monthStr = "0" + cmonth;
	}
	if(cday < 10) {
		dayStr = "0" + cday;
	}
	return cyear + '-' + monthStr + '-' + dayStr;
}

/*
 * 获取某个月份最后一天
 * 入参 XX年X月例如19-02
 */
function getMonthMaxDay(yearMonth) {
	if(yearMonth == null) {
		yearMonth = getYearMonthStr();
	}
	var dateArr = yearMonth.split('-');
	var yearStr = '20' + dateArr[0];
	var yearInt = parseInt(yearStr);
	var monthStr = dateArr[1];
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substr(1, monthStr.length)
	}
	var monthInt = parseInt(monthStr);
	var maxDay = 31;
	if(monthInt != 2) { //不是二月
		if(monthInt == 4 || monthInt == 6 || monthInt == 9 || monthInt == 11) {
			maxDay = 30;
		}
	} else if(monthInt == 2) {
		if(yearInt % 400 == 0 || (yearInt % 100 != 0 && yearInt % 4 == 0)) { //闰年
			maxDay = 29;
		} else {
			maxDay = 28;
		}
	}
	return maxDay;
}

function getMaxDayWithYMD(ymdStr) {
	var dateArr = ymdStr.split('-');
	var yearInt = parseInt(dateArr[0]);
	var monthStr = dateArr[1];
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substr(1, monthStr.length)
	}
	var monthInt = parseInt(monthStr);
	var maxDay = 31;
	if(monthInt != 2) { //不是二月
		if(monthInt == 4 || monthInt == 6 || monthInt == 9 || monthInt == 11) {
			maxDay = 30;
		}
	} else if(monthInt == 2) {
		if(yearInt % 400 == 0 || (yearInt % 100 != 0 && yearInt % 4 == 0)) { //闰年
			maxDay = 29;
		} else {
			maxDay = 28;
		}
	}
	return maxDay;
	
}

/*
 * 获取某周的日期数组
 * 入参 2019-02-01 2019-02-07
 * 出参[{'day':'01','mType':'T','mMonth':'02'},{}]
 * 'mType':'T',T本月,L上月,N下月
 */
function getDateArrWeek(stTime, endTime) {
	var startArr = stTime.split('-');
	var startMonth = startArr[1];
	if(startMonth.indexOf('0') == 0) {
		startMonth = startMonth.substring(1, startMonth.length);
	}
	var startDay = startArr[2];
	if(startDay.indexOf('0') == 0) {
		startDay = startDay.substring(1, startDay.length);
	}
	var startDayInt = parseInt(startDay);
	var endArr = endTime.split('-');
	var endMonth = endArr[1];
	if(endMonth.indexOf('0') == 0) {
		endMonth = endMonth.substring(1, endMonth.length);
	}
	var endDay = endArr[2];
	if(endDay.indexOf('0') == 0) {
		endDay = endDay.substring(1, endDay.length);
	}
	var endDayInt = parseInt(endDay);
	var descArray = [];
	if(startDayInt < endDayInt) { //同一个月
		for(var i = 0; i < 7; i++) {
			var descInt = startDayInt + i;
			var descStr = descInt;
			if(descInt < 10) {
				descStr = '0' + descInt;
			}
			var dayDic = {
				'day': descStr,
				'mType': 'T',
				'mMonth': startArr[1],
				'mYear': startArr[0]
			};
			descArray[i] = dayDic;
		}
	} else { //不同月
		var lastMaxDay = getMonthMaxDay(stTime);
		for(var i = startDayInt; i < lastMaxDay + 1; i++) {
			var dayDic = {
				'day': i,
				'mType': 'L',
				'mMonth': startArr[1],
				'mYear': startArr[0]
			};
			descArray.push(dayDic);
		}
		for(var i = 0; i < endDayInt; i++) {
			var descStr = 1 + i;
			var dayDic = {
				'day': '0' + descStr,
				'mType': 'T',
				'mMonth': endArr[1],
				'mYear': endArr[0]
			};
			descArray.push(dayDic);
		}
	}
	return descArray;
}

/*
 * 判断是第几周,并给出开始日期和结束日期
 * 入参 2017-12-06
 * 出参
 */
function getStEndDateWeek(dateStr) {
	if(dateStr == null) {
		dateStr = getTodayStr();
	}
	var thisWeekArr = thisWeek(dateStr);
	var startTime = thisWeekArr[0];
	var startArr = startTime.split('-');
	var startDay = startArr[2];
	if(startDay.indexOf('0') == 0) {
		startDay = startDay.substring(1, startDay.length);
	}
	var startDayInt = parseInt(startDay);
	var endTime = thisWeekArr[1];
	var endArr = endTime.split('-');
	var endDay = endArr[2];
	if(endDay.indexOf('0') == 0) {
		endDay = endDay.substring(1, endDay.length);
	}
	var endDayInt = parseInt(endDay);
	var weekStrArr = ['第1周', '第2周', '第3周', '第4周', '第5周'];
	var weekStr = '';
	if(startDayInt > endDayInt) {
		weekStr = '第1周';
	} else if(endDayInt % 7 == 0) {
		var index = parseInt(endDayInt / 7) - 1;
		weekStr = weekStrArr[index];
	} else {
		var index = parseInt(endDayInt / 7);
		weekStr = weekStrArr[index];
	}
	return [startTime, endTime, weekStr];
}

/*
 * 获取某月日期数组
 * 入参 XX年X月例如19-02
 * 出参[[第一周],[第XX周]]
 */
function getDateArrMonth(yearMonth) {
	var dateArr = yearMonth.split('-');
	var yearStr = '20' + dateArr[0];
	var yearInt = parseInt(yearStr);
	var monthStr = dateArr[1];
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substr(1, monthStr.length)
	}
	var monthInt = parseInt(monthStr);
	var maxDay = getMonthMaxDay(yearMonth);
	var lastMaxDay;
	var lastMonth = monthInt - 1;
	if(lastMonth == 0) {
		lastMonth = 12;
		lastMaxDay = getMonthMaxDay((yearInt - 1) % 100 + '-' + lastMonth);
	} else {
		lastMaxDay = getMonthMaxDay(yearInt % 100 + '-' + lastMonth);
	}
	var nextMonth = monthInt + 1;
	if(monthInt == 12) {
		nextMonth = 1;
	}
	//月初是周几
	var firstIndex = getWeekDayNum(yearStr, monthInt - 1, '01');
	var startInt = 1;
	if(firstIndex != 1) {
		startInt = lastMaxDay - (firstIndex - 2);
	}
	//月末是周几
	var endIndex = getWeekDayNum(yearStr, monthInt - 1, maxDay);
	var endInt = maxDay;
	if(endIndex != 7) {
		endInt = 7 - endIndex;
	}
	var length = maxDay + (firstIndex - 1) + (7 - endIndex);
	var descArr = new Array(length / 7);
	for(var i = 0; i < descArr.length; i++) {
		var weekArr = [];
		for(var j = 1; j < 8; j++) {
			if(i == 0 && j < firstIndex) {
				var myear = yearStr;
				if(lastMonth == 12) {
					myear = yearInt - 1;
				}
				var lastMonthStr = lastMonth;
				if(lastMonth < 10) {
					lastMonthStr = '0' + lastMonth;
				}
				var dayDic = {
					'day': startInt + j - 1,
					'mType': 'L',
					'mMonth': lastMonthStr,
					'mYear': myear
				};
				weekArr.push(dayDic);
			} else if(i == descArr.length - 1 && j > endIndex) {
				var myear = yearStr;
				if(monthInt == 12) {
					myear = yearInt + 1;
				}
				var nextMonthStr = nextMonth;
				if(nextMonth < 10) {
					nextMonthStr = '0' + nextMonth;
				}
				var dayInt = j - endIndex;
				var dayDic = {
					'day': ('0' + dayInt),
					'mType': 'N',
					'mMonth': nextMonthStr,
					'mYear': myear
				};
				weekArr.push(dayDic);
			} else {
				var dayInt = i * 7 + j - firstIndex + 1;
				if(dayInt < 10) {
					dayInt = '0' + dayInt;
				}
				var dayDic = {
					'day': dayInt,
					'mType': 'T',
					'mMonth': dateArr[1],
					'mYear': yearStr
				};
				weekArr.push(dayDic);
			}
		}
		descArr[i] = weekArr;
	}
	return descArr;
}

/*
 * 获取某天是周几
 * 入参 2019 02 01
 * 出参 2019-02-01-7 周日
 */
function getWeekDayNum(yearStr, monthStr, dayStr) {
	var tempDate = new Date(yearStr, monthStr, dayStr);
	var tempWeekIndex = parseInt(tempDate.getDay());
	var weekArr = [7, 1, 2, 3, 4, 5, 6];
	var weekInt = weekArr[tempWeekIndex];
	return weekInt;
}
/*
 * 获取本周还剩下几天
 * 入参 2019-02-01
 * 出参 4
 */
function getRemianDaysInWeek(dateStr) {
	var sarr = dateStr.split("-");
	var yearStr = parseInt(sarr[0]);
	var monthStr = parseInt(sarr[1]) - 1;
	var dayStr = parseInt(sarr[2]);

	var tempDate = new Date(yearStr, monthStr, dayStr);
	var tempWeekIndex = parseInt(tempDate.getDay());
	var weekArr = [7, 1, 2, 3, 4, 5, 6];
	var weekInt = weekArr[tempWeekIndex];
	return 8 - weekInt;
}

/*
 * 获取字符串日期的下一天
 * 入参：dayStr：日期字符串，举例 2017-01-01
 * 返回值：下一天字符串，举例：2017-01-02
 */
function getNextDay(dayStr) {
	var sarr = dayStr.split("-");
	var syear = parseInt(sarr[0]);
	var smonth = parseInt(sarr[1]) - 1;
	var sday = parseInt(sarr[2]);
	var sdate = new Date(syear, smonth, sday, 0, 0, 0);
	var daytime = sdate.getTime() + 1000 * 60 * 60 * 25;
	var newDate = new Date(daytime);
	var cyear = newDate.getFullYear();
	var cmonth = newDate.getMonth() + 1;
	var cday = newDate.getDate();
	var thisDay = cyear + "-";
	if(cmonth < 10) {
		thisDay += "0";
	}
	thisDay += cmonth + "-";
	if(cday < 10) {
		thisDay += "0";
	}
	thisDay += cday;
	return thisDay;
}

function getLastDay(dayStr){
	var sarr = dayStr.split("-");
	var syear = parseInt(sarr[0]);
	var smonth = parseInt(sarr[1]) - 1;
	var sday = parseInt(sarr[2]);
	var sdate = new Date(syear, smonth, sday, 0, 0, 0);
	var daytime = sdate.getTime() - 1000 * 60 * 60 * 24;
	var newDate = new Date(daytime);
	var cyear = newDate.getFullYear();
	var cmonth = newDate.getMonth() + 1;
	var cday = newDate.getDate();
	var thisDay = cyear + "-";
	if(cmonth < 10) {
		thisDay += "0";
	}
	thisDay += cmonth + "-";
	if(cday < 10) {
		thisDay += "0";
	}
	thisDay += cday;
	return thisDay;
}

/*
 * 用字符串转换为date类型
 * 举例：入参：2017-01-01 
 *      出参：相应的Date对象
 */
function getDateWithStr(dayStr) {
	var sarr = dayStr.split("-");
	var syear = parseInt(sarr[0]);
	var smonth = parseInt(sarr[1]) - 1;
	var sday = parseInt(sarr[2]);
	var sdate = new Date(syear, smonth, sday);
	return sdate;
}

/*
 * 计算结束时间
 * 参数: startTimeStr 开始时间 例如 2018-03-19
 * 		daysInterval 时间段 例如 5
 * 返回值 结束时间 例如 2018-03-24
 */
function getEndTimeStr(startTimeStr, daysInterval) {
	var daysIntervalInt = parseInt(daysInterval);
	var endTimeStr = startTimeStr;
	for(var i = 0; i < daysIntervalInt; i++) {
		endTimeStr = getNextDay(endTimeStr);
	}
	return endTimeStr;
}

/*
 * 入参格式31/03/2019
 * 出参 2019-03-31
 */
function changeDateFormat(dateStr) {
	var dateArr = dateStr.split('/');
	var dayStr = dateArr[0];
	var monthStr = dateArr[1];
	var yearStr = dateArr[2];
	return yearStr + '-' + monthStr + '-' + dayStr;
}

/*
 * 入参格式31/03/2019
 * 出参 2019-03-31
 */
function changeDateChineseFormat(dateStr) {
	var sp = '/';
	if(dateStr.indexOf(sp) < 0) {
		sp = '-';
		if(dateStr.indexOf(sp) < 0) {
			console.log('changeDateChineseFormat 入参有误', dateStr);
			return '';
		}
	}
	var dateArr = dateStr.split(sp);
	var dayStr = dateArr[0];
	var monthStr = dateArr[1];
	var yearStr = dateArr[2];
	if(dayStr.indexOf('0') == 0) {
		dayStr = dayStr.substring(1, dayStr.length);
	}
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substring(1, monthStr.length);
	}
	return yearStr + '年' + monthStr + '月' + dayStr + '日';
}

function secondStrChangeTimeStr(secondStr) {
	var secondInt = parseInt(secondStr);
	if(isNaN(secondInt)) {
		return '';
	}
	var hour = parseInt(secondInt / 3600);
	var minutes = secondInt % 3600;
	var minute = parseInt(minutes / 60);
	var seconds = minutes / 60;
	var second = parseInt(seconds / 60);
	var descStr = '';
	if(hour < 10) {
		descStr += '0'
	}
	descStr += hour + ':';
	if(minute < 10) {
		descStr += '0'
	}
	descStr += minute + ':'
	if(second < 10) {
		descStr += '0'
	}
	descStr += second
	return descStr;
}

/*
 * 日期转换格式
 */
Date.prototype.Format = function(fmt) {
	var o = {
		"M+": this.getMonth() + 1, //月份   
		"D+": this.getDate(), //日   
		"h+": this.getHours(), //小时   
		"m+": this.getMinutes(), //分   
		"s+": this.getSeconds(), //秒   
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度   
		"S": this.getMilliseconds() //毫秒   
	};
	if(/(Y+)/.test(fmt))
		fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for(var k in o)
		if(new RegExp("(" + k + ")").test(fmt))
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	return fmt
}

/*
 * 计算日期长度
 */
function computeDatesInterval(stDateStr, endDateStr) {
	var isLess = true;
	if(stDateStr > endDateStr) {
		isLess = false;
		var tempDateStr = stDateStr;
		stDateStr = endDateStr;
		endDateStr = tempDateStr;
	}
	var stDateArr = stDateStr.split('-');
	var stYear = stDateArr[0];
	var stYearInt = parseInt(stYear);
	var stMonth = stDateArr[1];
	if(stMonth.indexOf('0') == 0) {
		stMonth = stMonth.substring(1, 2);
	}
	var stMonthInt = parseInt(stMonth);
	var stDay = stDateArr[2];
	if(stDay.indexOf('0') == 0) {
		stDay = stDay.substring(1, 2);
	}
	var stDayInt = parseInt(stDay);

	var endDateArr = endDateStr.split('-');
	var endYear = endDateArr[0];
	var endYearInt = parseInt(endYear);
	var endMonth = endDateArr[1];
	if(endMonth.indexOf('0') == 0) {
		endMonth = endMonth.substring(1, 2);
	}
	var endMonthInt = parseInt(endMonth);
	var endDay = endDateArr[2];
	if(endDay.indexOf('0') == 0) {
		endDay = endDay.substring(1, 2);
	}
	var endDayInt = parseInt(endDay);
	var daysInt = 0;
	var daysArray = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	if(stYearInt % 4 == 0 && stYearInt % 100 != 0 || stYearInt % 400 == 0) {
		daysArray[1] = 29;
	}
	if(stYearInt == endYearInt) {
		if(stMonthInt == endMonthInt) {
			if(stDayInt == endDayInt) {
				daysInt = 1;
			} else {
				daysInt = endDayInt - stDayInt + 1;
			}
		} else { //同年,不同月
			var oneStDay = daysArray[stMonthInt - 1] - stDayInt + 1;
			daysInt += oneStDay;
			for(var i = stMonthInt + 1; i < endMonthInt; i++) {
				daysInt += daysArray[i - 1];
			}
			daysInt += endDayInt;
		}
	} else { //不同年
		var stYearLen = 0;
		stYearLen += daysArray[stMonthInt - 1] - stDayInt + 1;
		console.log(stYearLen);
		for(var i = stMonthInt + 1; i <= 12; i++) {
			stYearLen += daysArray[i - 1];
			console.log(stYearLen, daysArray[i - 1]);
		}
		daysInt = stYearLen;
		console.log('stYearInt', stYearInt, daysInt);
		//整年
		for(var i = stYearInt + 1; i < endYearInt; i++) {
			if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
				daysInt += 366;
				console.log('year', i, 366)
			} else {
				daysInt += 365;
				console.log('year', i, 365)
			}
		}
		console.log('daysInt', daysInt);
		//最后一年
		if(endYearInt % 4 == 0 && endYearInt % 100 != 0 || endYearInt % 400 == 0) {
			daysArray[1] = 29;
		} else {
			daysArray[1] = 28;
		}
		for(var i = 1; i < endMonthInt; i++) {

			daysInt += daysArray[i - 1];
		}
		daysInt += endDayInt;
	}
	if(isLess) {
		return daysInt;
	}
	return 0 - daysInt;
}

function getFullLastMonth(ymStr) {
	var currArr = ymStr.split('-');
	var yearInt = parseInt(currArr[0]);
	var monthStr = currArr[1];
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substring(1, 2);
	}
	var monthInt = parseInt(monthStr);
	monthInt -= 1;
	if(monthInt == 0) {
		yearInt -= 1;
		monthInt = 12;
	}
	monthStr = monthInt + '';
	if(monthInt < 10) {
		monthStr = '0' + monthInt;
	}
	
	return  yearInt + '-' + monthStr;
}

function getFullNextMonth(ymStr) {
	var currArr = ymStr.split('-');
	var yearInt = parseInt(currArr[0]);
	var monthStr = currArr[1];
	if(monthStr.indexOf('0') == 0) {
		monthStr = monthStr.substring(1, 2);
	}
	var monthInt = parseInt(monthStr);
	monthInt += 1;
	if(monthInt == 13) {
		yearInt += 1;
		monthInt = 1;
	}
	monthStr = monthInt + '';
	if(monthInt < 10) {
		monthStr = '0' + monthInt;
	}
	return  yearInt + '-' + monthStr;
}

//输入年月,出来整个月份例如2021-09
//输出[]
function getFullMonthArr(){
	
}